package com.lap.auth.domain.organization.service;

import com.lap.auth.domain.organization.Organization;
import com.lap.auth.domain.organization.repository.OrgRepository;
import com.lap.auth.shared.errors.UserError;
import com.lap.framework.common.exception.BizException;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
public class OrgValidator {

  private final OrgRepository orgRepository;

  public Organization assertOrgExists(Integer id) {
    return orgRepository
        .findById(id)
        .orElseThrow(() -> BizException.newBiz(UserError.ORG_NOT_FOUND));
  }
}
